/*
 *  script.h
 *  Incoming!
 *
 *  Created by Ryan Oldis on 7/25/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#include "global.h"

#define Script (luaScript::Instance())
class luaScript
{
	
public:
	
	// the lua state
	lua_State* L;
	
	static luaScript* Instance();
	
	
	void bindFunctions();
	
	void doFile(std::string file);
	void doString(std::string str);
	
	void mainUpdate();
	
	void setVar(std::string var, int i);
	void setVar(std::string var, float i);
	void setVar(std::string var, std::string i);
	
	
	void getGlobal(std::string glb);
	
	void push(int i);
	void push(float f);
	void push(std::string str);
	
	bool call(int args, int results);
	
	void newBlankTable();
	void setField(const char* key, int i);
	void setField(const char* key, float i);
	void setField(const char* key, const char* str);
	
	void setGlobal(std::string name);
	
	
	~luaScript();
	
protected:
	
	luaScript();
	
	static luaScript* _instance;
	
};